package com.ricky;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * SpringBoot运行原理分析
 *
 * 注意  此种方式 默认需要内置tomcat或者内置jetty支持
 *
 * 注意2.0以后 官方demo是使用的@EnableAutoConfiguration
 * 但是只能加载启动类本身  无法加载本包或者其他包中的注解类
 * 如需支持则开启@ComponentScan
 */
//@EnableAutoConfiguration
//@ComponentScan
//@ComponentScan("com.ricky02")
//@SpringBootApplication
public class SpringBootApplication05 {

    /**
     * 开启SpringBoot服务
     * @param args
     */
    public static void main(String[] args) {
        args=new String[2];
        //等价于 new SpringApplication(SpringBootApplication.class).run(args);
        args[0]="--logging.level.root=debug";
        args[1]="--logging.file=d:/work/log/chapter05_add_2new.log";
        /*
            --logging.level.root=info --logging.file=d:/work/chapter02.log
        * */
//        SpringApplication.run(SpringBootApplication05.class,args);
        SpringApplication application = new SpringApplication(SpringBootApplication05.class);
        ConfigurableApplicationContext context = application.run(args);
    }
}